/**
 * Copyright By Nanjing Fujitsu Nanda Software Technology Co., Ltd
 * 上午10:25:19
 * CoreRoleService.java
 * 
 */
package com.fujitsu.nanjing.mobile.service;

import com.fujitsu.nanjing.mobile.dao.CoreRoleDao;
import com.fujitsu.nanjing.mobile.exception.NotOneException;
import com.fujitsu.nanjing.mobile.model.hibernate.CoreRole;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import javax.annotation.Resource;

/**
 * @author qixb.fnst
 * 
 */
@Service
@Transactional
public class CoreRoleService implements BaseService<CoreRole> {
    @Resource
    private CoreRoleDao coreRoleDao;

    @Override
    public CoreRole find(int id) {

        return coreRoleDao.query(CoreRole.class, id);
    }

    @Override
    public CoreRole modify(CoreRole t) {

        return coreRoleDao.update(t);
    }

    @Override
    public void delete(CoreRole t) {
        coreRoleDao.delete(t);

    }

    @Override
    public CoreRole add(CoreRole t) {

        return coreRoleDao.insert(t);
    }

    @Override
    public List<CoreRole> find(String queryString) {

        return coreRoleDao.query(queryString);
    }

    /**
     * qixib.fnst
     * @param roleId
     * @return
     * @throws NotOneException 
     */
    public CoreRole getRoleByRoleId(int roleId) throws NotOneException {
       
        return coreRoleDao.getRoleByRoleId(roleId);
    }

}
